package com.compass.doctor.ui.patient.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.databinding.LayoutCaseHistoryItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.ext.gone
import com.compass.framework.ext.visible
import com.compass.framework.model.InquiryCase
import com.compass.framework.utils.DateUtils

/**
 * Description： 病历记录adapter
 * Date:2023/12/8 11:21
 */
class CaseHistoryAdapter : BaseRecyclerViewAdapter<InquiryCase, LayoutCaseHistoryItemBinding>() {



    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutCaseHistoryItemBinding>,
        item: InquiryCase?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {

            tvDiagnosis.text = item.diseaseDescription
            if (position==0)   tvPaymentStatus.visible() else   tvPaymentStatus.gone()
            item.updateTime?.let {
                tvTime.text=DateUtils.conversionTime(it,DateUtils.FORMAT_TWO)
            }



        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutCaseHistoryItemBinding {
        return LayoutCaseHistoryItemBinding.inflate(layoutInflater, parent, false)
    }
}